package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/13 17:17
 * 邮箱：648859026@qq.com
 */
public class UserChangePassowrdAction extends AHttpService<PbBean.PbResUserChangePassword>{
    /**
     * 修改密码
     * @param context
     * @param password
     * @param newPassword
     * @return
     */
    public static UserChangePassowrdAction newInstance(Context context, String password, String newPassword){
        return new UserChangePassowrdAction(context, password, newPassword);
    }
    private String password;
    private String newPassword;
    private UserChangePassowrdAction(Context context, String password, String newPassword) {
        super(context);
        this.password = password;
        this.newPassword = newPassword;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqUserChangePassword.Builder builder = PbBean.PbReqUserChangePassword.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setPassword(password);
        builder.setNewPassword(newPassword);

        return apiService.userChangePassowrd(builder.build());
    }
}
